<template>
    <div>
        <Row  class="user-info-con">
            <Col span="6">
                <span>学生姓名：{{data.stuName}}</span> 
            </Col>
            <Col span="6">
                <span>来电号码：{{data.telNo | getHiddenText}}</span>  
            </Col>
            <Col span="6">
                <span>学生ID：{{data.stuId}}</span> 
            </Col>
            <Col span="6">
                <span>注册时间：{{data.registerDateTime | formatDate}}</span>
            </Col>
        </Row>
        <Row  class="user-info-con">
            <Col span="6">
                <span>年龄：{{data.birthday | getAge}}岁</span>  
            </Col>
            <Col span="6">
                <span>出生年月日：{{data.birthday | formatDate}}</span>  
            </Col>
        </Row>
       
        <Row  class="user-info-con">
            <Col span="24">
                <p> 家庭地址:</p>
                <ul class="address-container">  
                    <li v-for="item in data.addresses">
                        <span v-if="item.userName">姓名:{{item.userName}}</span>
                        <span v-if="item.mobile">电话:{{item.mobile}}</span>
                        <span v-if="item.province">省:{{item.province}}</span>
                        <span v-if="item.city">市:{{item.city}}</span>
                        <span v-if="item.district">区:{{item.district}}</span>
                        <span v-if="item.address">详细地址:{{item.address}}</span>
                     </li> 
                </ul>
            </Col>  
        </Row>
    </div>
</template>
<style scoped>
    .user-info-con {
        text-align: left;
        line-height: 30px;
        font-size: 12px;
    }
    
    .user-info-con span {
        white-space: nowrap;
    }
    
    .more-link {
        display: flex;
        justify-content: flex-start;
        font-size: 12px;
    }
</style>
<script>
    import thirdService from 'service/thirdService.js'
    import {
        formatDate,
        getAge,
        getHiddenText
    } from '@/libs/filter.js'
    export default {
        name: 'userInfo',
        props: {
            isHasMore: {
                type: Boolean,
                default: true
            },
            data: Object
        },

        created() {
            // this.getStudentById(stuId)
            // this.getStudentsByMobile(this.telNo)
        },
        filters: {
            formatDate: function(value) {
                return formatDate(value, 'yyyy-MM-dd')
            },
            getAge: function(value) {
                return getAge(value)
            },
            getHiddenText(mobile) {
                return getHiddenText(mobile)
            }
        },
        methods: {
            async getStudentById(stuId) {
                let jsondata = await thirdService.getStudentById({
                    'id': stuId
                })
                console.log(jsondata);
            },
            async getStudentsByMobile(telNo) {
                let jsondata = await thirdService.getStudentsByMobile({
                    'mobile': telNo
                })
                console.log(jsondata);
            }
        }

    }
</script>